package com.jieao.front.controller;

import com.jieao.common.core.controller.BaseController;
import com.jieao.common.core.domain.AjaxResult;
import com.jieao.common.core.domain.Ztree;
import com.jieao.common.core.page.TableDataInfo;
import com.jieao.content.domain.Album;
import com.jieao.content.domain.ArticleComment;
import com.jieao.content.domain.ArticleCommentLike;
import com.jieao.content.dto.AlbumDto;
import com.jieao.content.dto.ArticleCommentDto;
import com.jieao.content.dto.ArticleDto;
import com.jieao.content.dto.CatalogDto;
import com.jieao.content.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * @Description 相册页面 控制器
 * @Author weifanl
 * @Date2020/7/12 13:14
 **/
@Controller
@RequestMapping("/front/album")
public class FrontAlbumController extends BaseController {
    @Autowired
    private IAlbumService albumService;
    @Autowired
    private ICatalogService catalogService;

    @GetMapping(value = "")
    public String album() {
        return "front/album";
    }


    @GetMapping("/treeData")
    @ResponseBody
    public List<Ztree> treeData(CatalogDto catalogDto) {
        List<Ztree> ztrees = catalogService.selectCatalogTree(catalogDto);
        return ztrees;
    }

    /**
     * 分页获得图片
     * @param
     * @return {com.jieao.common.core.page.TableDataInfo}
     * @author LWF
     * @date 2020/7/12 13:16
     **/
    @PostMapping(value = "/albumList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    public TableDataInfo albumList(Album album) {
        startPage();
        List<AlbumDto> albumDtos = albumService.selectAlbumList(album);
        return getDataTable(albumDtos);
    }

}
